package com.jiwang.mail.controller;

import com.jiwang.mail.dto.QueryMailInfo;
import com.jiwang.mail.dto.SendMailInfo;
import com.jiwang.mail.service.MailService;
import com.jiwang.mail.util.result.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 沈伟峰
 */
@RestController
@CrossOrigin
public class MailController {

    @Autowired
    private MailService mailService;

    @PostMapping("/mail/send")
    public JsonResult sendMail(SendMailInfo info) {
        return mailService.sendMail(info);
    }

    @PostMapping("/mail/query")
    public JsonResult queryMails(QueryMailInfo info) {
        return mailService.queryMails(info);
    }
}
